/*
 * VisualMidlet.java
 *
 * Created on 13. september 2007, 17:06
 */

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

/**
 *
 * @author t358084
 */
public class VisualMidlet extends MIDlet implements CommandListener {
	
	/** Creates a new instance of VisualMidlet */
	public VisualMidlet() {
		initialize();
	}
	
	private org.netbeans.microedition.svg.SVGSplashScreen svgSplashScreen1;//GEN-BEGIN:MVDFields
	private Command exitCommand1;
	private javax.microedition.m2g.SVGImage svgImage1;//GEN-END:MVDFields
	
//GEN-LINE:MVDMethods

	/** Called by the system to indicate that a command has been invoked on a particular displayable.//GEN-BEGIN:MVDCABegin
	 * @param command the Command that ws invoked
	 * @param displayable the Displayable on which the command was invoked
	 */
	public void commandAction(Command command, Displayable displayable) {//GEN-END:MVDCABegin
	// Insert global pre-action code here
		if (displayable == svgSplashScreen1) {//GEN-BEGIN:MVDCABody
			if (command == svgSplashScreen1.DISMISS_COMMAND) {//GEN-END:MVDCABody
				// Insert pre-action code here
				exitMIDlet();//GEN-LINE:MVDCAAction3
				// Insert post-action code here
			}//GEN-BEGIN:MVDCACase3
		}//GEN-END:MVDCACase3
	// Insert global post-action code here
}//GEN-LINE:MVDCAEnd

	/** This method initializes UI of the application.//GEN-BEGIN:MVDInitBegin
	 */
	private void initialize() {//GEN-END:MVDInitBegin
		// Insert pre-init code here
		getDisplay().setCurrent(get_svgSplashScreen1().getSvgCanvas());//GEN-LINE:MVDInitInit
		// Insert post-init code here
	}//GEN-LINE:MVDInitEnd
	
	/**
	 * This method should return an instance of the display.
	 */
	public Display getDisplay() {//GEN-FIRST:MVDGetDisplay
		return Display.getDisplay(this);
	}//GEN-LAST:MVDGetDisplay
	
	/**
	 * This method should exit the midlet.
	 */
	public void exitMIDlet() {//GEN-FIRST:MVDExitMidlet
		getDisplay().setCurrent(null);
		destroyApp(true);
		notifyDestroyed();
	}//GEN-LAST:MVDExitMidlet

	/** This method returns instance for svgSplashScreen1 component and should be called instead of accessing svgSplashScreen1 field directly.//GEN-BEGIN:MVDGetBegin2
	 * @return Instance for svgSplashScreen1 component
	 */
	public org.netbeans.microedition.svg.SVGSplashScreen get_svgSplashScreen1() {
		if (svgSplashScreen1 == null) {//GEN-END:MVDGetBegin2
			// Insert pre-init code here
			svgSplashScreen1 = new org.netbeans.microedition.svg.SVGSplashScreen(get_svgImage1(), getDisplay());//GEN-BEGIN:MVDGetInit2
			svgSplashScreen1.setCommandListener(this);
			svgSplashScreen1.setTitle("ReneSPASH\r\n");
			svgSplashScreen1.setTimeout(10000);//GEN-END:MVDGetInit2
			// Insert post-init code here
		}//GEN-BEGIN:MVDGetEnd2
		return svgSplashScreen1;
	}//GEN-END:MVDGetEnd2
	/** This method returns instance for exitCommand1 component and should be called instead of accessing exitCommand1 field directly.//GEN-BEGIN:MVDGetBegin8
	 * @return Instance for exitCommand1 component
	 */
	public Command get_exitCommand1() {
		if (exitCommand1 == null) {//GEN-END:MVDGetBegin8
			// Insert pre-init code here
			exitCommand1 = new Command("Exit", Command.EXIT, 1);//GEN-LINE:MVDGetInit8
			// Insert post-init code here
		}//GEN-BEGIN:MVDGetEnd8
		return exitCommand1;
	}//GEN-END:MVDGetEnd8

	/** This method returns instance for svgImage1 component and should be called instead of accessing svgImage1 field directly.//GEN-BEGIN:MVDGetBegin10
	 * @return Instance for svgImage1 component
	 */
	public javax.microedition.m2g.SVGImage get_svgImage1() {
		if (svgImage1 == null) {//GEN-END:MVDGetBegin10
			// Insert pre-init code here
			try {//GEN-BEGIN:MVDGetInit10
				svgImage1 = (javax.microedition.m2g.SVGImage) javax.microedition.m2g.SVGImage.createImage(VisualMidlet.class.getResourceAsStream("/resources/map.svg"), null);
			} catch (java.io.IOException exception) {
				exception.printStackTrace();
			}//GEN-END:MVDGetInit10
			// Insert post-init code here
		}//GEN-BEGIN:MVDGetEnd10
		return svgImage1;
	}//GEN-END:MVDGetEnd10
		
	public void startApp() {
	}
	
	public void pauseApp() {
	}
	
	public void destroyApp(boolean unconditional) {
	}
	
}
